
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>我卖出的</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <link rel="shortcut icon" href="/static/favicon.ico">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="stylesheet" href="/static/css/sm.min.css">
    <link rel="stylesheet" href="/static/css/sm-extend.min.css">

    <!--icon css-->
    <!--<link rel="stylesheet" href="css/icon-style.css">-->


    <!--重写css-->
    <style>
        .tc{
            width: 100%;
            height: 2rem;
        }

    </style>
</head>

<body>
<!--头部-->
<header class="bar bar-nav">
    <a class="icon icon-left pull-left" href="JavaScript:history.back(-1)"></a>
    <h1 class="title">我卖出的</h1>
</header>

<!-- 内容区-->
<div class="content">

</div>


<script type='text/javascript' src='/static/lib/zepto/zepto.min.js' charset='utf-8'></script>
<script type='text/javascript' src='/static/js/sm.min.js' charset='utf-8'></script>
<script type='text/javascript' src='/static/js/sm-extend.min.js' charset='utf-8'></script>
<script type="text/javascript" src="/static/js/deatilPage.js" charset="utf-8"></script>
<script>
    $(document).ready(function () {
        $.ajax({
            type: "get",
            url: "/setting/detail",
            dataType: "json",
            success: function (re) {
                if (!re.status) {
                    var data = re.data.selledList.data;
                    if (!data.length){
                        $.toast("您还没有卖出过商品！");
                        $('.content').append("<p class=\"text-center\">您还没有卖出过商品</p>");
                    }else {
                        var result = '';
                        for (var i = 0;i<data.length;i++){
                            var star = new Array();//新建一个数组，
                            star = data[i].good_img.split(',');//分割图片
                            result+=
                                "<div class=\"card\">\n" +
                                "        <div class=\"card-header\">\n" +
                                "            <div class=\"item-media\" style=\"width: 70%\">\n" +
                                "                <img src=\""+star[0]+"\" width=\"44\" style=\"border-radius: 5px;margin-right:0.5rem;float: left\">\n" +
                                "                <div class=\"item-title\" >\n" +
                                "                    <span>"+data[i].name+"</span><br>\n" +
                                "                    <span style=\"font-size: 0.4rem!important; color: red\">￥"+data[i].price+"</span>\n" +
                                "                </div>\n" +
                                "            </div>\n" +
                                "        </div>\n" +
                                "        <div class=\"card-footer\">\n" +
                                "            <div class=\"\" style=\"width: 100%\">\n" +
                                "                <div class=\"pull-right\" ><span class=\"icon icon-remove\" data-id='"+data[i].good_id+"'></span> </div>\n" +
                                "                <div class=\"button button-light pull-right\" style=\"margin-right: .5rem\" onclick=\"orderDetail("+data[i].good_id+") \">详情</div>\n" +
                                "            </div>\n" +
                                "        </div>\n" +
                                "    </div>"
                        }
                        $('.content').append(result);
                    }
                }else {
                    $.toast(re.msg);
                }
            }
        });

        $(document).on('click', '.icon-remove',function (remove) {
            var remove = $(this);
            var goodId = remove.attr('data-id');
            $.confirm('确定删除该订单吗?',
                function () {
                    $.ajax({
                        type: "get",
                        url: "/sys/good/updateStatusByMyself",
                        data: {goodId: goodId},
                        dataType: "json",
                        success: function (re) {
                            if (!re.status) {
                                $.toast(re.msg);
                                remove.parents('.card').remove();
                            } else {
                                $.toast(re.msg);
                            }
                        }
                    });
                },
                function () {

                }
            );
        });
    });

    function orderDetail() {

    }
</script>
</body>

</html>